<template>
  <div class="si-wrap" v-loading = "loading">
    <div class="gs-nav">我的钱包 > 提现记录</div>
    <div class="si-content">
      <div class="si-content-bottom">
        <div class="table-box">
          <el-table
            :data="tableData"
            border
            :header-cell-style="titleStyleA"
            :cell-style="titleStyle"
            style="width: 100%">
            <el-table-column
              prop="id"
              label="付款单号"
              >
            </el-table-column>
            <el-table-column
              prop="createTime"
              label="申请时间"
              width="180px"
              >
            </el-table-column>
            <el-table-column
              prop="money"
              label="订单金额（元）"
              >
            </el-table-column>
            <el-table-column
              prop="bankNo"
              label="收款账户"
              >
            </el-table-column>
            <el-table-column
              prop="appStatus"
              label="状态"
              >
            </el-table-column>
            <el-table-column
              prop="reason"
              label="说明"
              width="180px"
              >
            </el-table-column>
          </el-table>
        </div>
      </div>
      <!-- <div class="pagination" v-show = "pageSize >= 8"> -->
      <div class="pagination"  v-show = "total > 0">
        <el-pagination
          background
          :current-page = "param.pageNum"
          @current-change="changeCurrentPage"
          :page-sizes="[8,16,24]"
          @size-change="changeCurrentPageSize"
          :total = "total"
          layout="total, sizes, prev, pager, next, jumper"
        >
        </el-pagination>
        <div class="pageSearch" @click="pageSearch">确定</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  async fetch({store}) {
    await store.commit('setWalletIndex', 2)
    await store.commit('setWalletTwoIndex', 11)
  },
  layout: 'internalouts',
  components: {
    
  },
  data() {
    return {
      tableData: [],
      param:{
        pageNum:1, //第一页
        pageSize:8, //每页的条数
      },
      total:0, //总条数
      loading:false, //页面加载效果
    }
  },
  mounted() {
    this.getCashHistory();
  },
  methods: {
    changeCurrentPage(page){ //改变当前页数
      this.param.pageNum = page; //赋值给当前页
      this.getCashHistory(); //调用提现记录接口
      this.$scrollTo();
    },
    changeCurrentPageSize(pageSize){ //改变条数
      this.param.pageNum = 1; //重新请求第一页
      this.param.pageSize = pageSize;  //设置条数
      this.getCashHistory();//调用提现记录接口
      this.$scrollTo();
    },
    pageSearch(){ //点击确定按钮时候调用提现记录
      this.getCashHistory();//调用提现记录接口
      this.$scrollTo();
		},
    titleStyleA({row, rowIndex}) {
      return 'text-align:center;background:#FAFAFA'
    },
    titleStyle({row, rowIndex}) {
      return 'text-align:center'
    },
    getCashHistory(){ //提现记录
      this.loading = true;
      this.$axios.$post('cashHistory',this.param).then(res => {
        this.loading = false;
        if(res.status === 200 ){
          this.tableData = res.obj.list;
          this.total = res.obj.total;
        }else{
          this.$message.warning(res.msg)
        }
       })
        .catch(error => {
          this.$message.warning('请求失败');
          this.loading = false;
        })
    }
  },
}
</script>
<style scoped>
  .si-content-bottom {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
  }
  .si-content-bottom .title {
    display: flex;
    align-items: flex-start;
    color: #0096e6;
    font-size: 14px;
  }
  .si-content-bottom .title img {
    width: 20px;
    height: 20px;
    margin-left: 6px;
    margin-top: -2px;
  }
  .si-content-bottom .title p {
    border-bottom: 1px solid #0096e6;
    padding-bottom: 12px;
  }
  .select-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
  }
  .select-time .time-right {
    width: 100px;
    height: 30px;
    background: #0096e6;
    color: #fff;
    text-align: center;
    line-height: 30px;
    font-size: 14px;
    border-radius: 100px;
    cursor: pointer;
  }
  .time-box {
    display: flex;
    align-items: center;
  }
  .time-box p {
    margin: 0 5px;
  }
  .time-style {
    width: 140px;
  }
  .time-left {
    display: flex;
    align-items: center;
  }
  .time-left-txt {
    font-size: 14px;
    color: #666;
    margin-right: 10px;
  }
  /* 分页样式 */
  .pagination{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    margin:20px 0 50px 0;
  }
  .pagination .pageSearch{
    width:60px;
    height:28px;
    line-height:28px;
    text-align:center;
    border-radius:15px;
    background:#0096e6;
    color:#ffffff;
    font-size:14px;
    cursor:pointer;
    margin-left:10px;
    user-select:none;
  }
  .pagination .pageSearch:hover{
    background:#66B1FF;
  }
  /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active{
    background-color:#0096e6;
  }
</style>
